package org.nightstudio.common.util.valid;

import java.util.Set;

import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;

public class ValidUtil {
	private static ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
	private static Validator validator = factory.getValidator();
	
	public static ValidatorFactory getValidatorFactory () {
		return factory;
	}
	
	public static Validator getValidator () {
		return validator;
	}
	
	public static boolean hasViolation(Set<?> violations) {
		return (violations != null && violations.size() > 0);
	}
}
